import { formatDate } from '@/utils/formatTime'
import { TableColumns } from '@pureadmin/table'

interface TableColumnList extends Array<TableColumns> {}

export function useTable() {
  const columns: TableColumnList = [
    { prop: 'id', label: 'ID', width: 80, align: 'center' },
    { prop: 'sort', label: '排序', width: 80, align: 'center' },

    { prop: 'name', label: '参数模版名称', minWidth: 120, align: 'center' },

    {
      prop: 'createTime',
      label: '创建时间',
      minWidth: 180,
      align: 'center',
      formatter({ createTime }) {
        return formatDate(createTime)
      }
    },
    {
      label: '操作',
      fixed: 'right',
      minWidth: 168,
      align: 'center',
      slot: 'operation'
    }
  ]

  return {
    columns
  }
}
